More code being dropped into a common place.
-Subproject commit 1332d9713365a53fae76570a3c484753f9bcbb30
+Subproject commit ab2588da8442fc6135af13ee624dd91b73a7051c
{
child = g_file_get_child (parent, (char*)components->pdata[i]);
- if (!ot_gfile_ensure_directory (child, FALSE, error))
+ if (!gs_file_ensure_directory (child, FALSE, NULL, error))
goto out;
g_clear_object (&parent);
goto out;
}
- if (!ot_gfile_ensure_directory (self->pending_dir, FALSE, error))
+ if (!gs_file_ensure_directory (self->pending_dir, FALSE, NULL, error))
goto out;
self->config = g_key_file_new ();
ot_lobj GFile *parent = NULL;
parent = g_file_get_parent (dest);
- if (!ot_gfile_ensure_directory (parent, FALSE, error))
+ if (!gs_file_ensure_directory (parent, FALSE, cancellable, error))
goto out;
if (is_regular)
{
dir = g_file_get_child (self->remote_heads_dir, remote);
- if (!ot_gfile_ensure_directory (dir, FALSE, error))
+ if (!gs_file_ensure_directory (dir, FALSE, NULL, error))
goto out;
}
goto out;
objdir = g_file_get_parent (loose_path);
- if (!ot_gfile_ensure_directory (objdir, TRUE, error))
+ if (!gs_file_ensure_directory (objdir, TRUE, cancellable, error))
{
g_prefix_error (error, "Creating cache directory %s: ",
gs_file_get_path_cached (objdir));
return G_FILE_TYPE_UNKNOWN;
}
-gboolean
-ot_gfile_ensure_directory (GFile *dir,
- gboolean with_parents,
- GError **error)
-{
- gboolean ret = FALSE;
- GError *temp_error = NULL;
-
- if (!g_file_make_directory (dir, NULL, &temp_error))
- {
- if (with_parents &&
- g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
- {
- ot_lobj GFile *parent = NULL;
-
- g_clear_error (&temp_error);
-
- parent = g_file_get_parent (dir);
- if (parent)
- {
- if (!ot_gfile_ensure_directory (parent, TRUE, error))
- goto out;
- }
- if (!ot_gfile_ensure_directory (dir, FALSE, error))
- goto out;
- }
- else if (!g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
- {
- g_propagate_error (error, temp_error);
- goto out;
- }
- else
- g_clear_error (&temp_error);
- }
-
- ret = TRUE;
- out:
- return ret;
-}
GFile *
ot_gfile_from_build_path (const char *first, ...)
if (!enumerator)
goto out;
- if (!ot_gfile_ensure_directory (dest, FALSE, error))
+ if (!gs_file_ensure_directory (dest, FALSE, cancellable, error))
goto out;
while ((file_info = g_file_enumerator_next_file (enumerator, cancellable, &temp_error)) != NULL)
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
{
- if (!ot_gfile_ensure_directory (dest_child, FALSE, error))
+ if (!gs_file_ensure_directory (dest_child, FALSE, cancellable, error))
goto out;
/* Can't do this even though we'd like to; it fails with an error about
GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-gboolean ot_gfile_ensure_directory (GFile *dir, gboolean with_parents, GError **error);
-
gboolean ot_gfile_load_contents_utf8 (GFile *file,
char **contents_out,
char **etag_out,
parent = g_file_get_parent (dest);
/* FIXME actually we need to copy permissions and xattrs */
- if (!ot_gfile_ensure_directory (parent, TRUE, error))
+ if (!gs_file_ensure_directory (parent, TRUE, cancellable, error))
goto out;
if (!g_file_copy (src, dest, G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA,
deploy_target_path_tmp = g_file_resolve_relative_path (deploy_dir, deploy_target_fullname_tmp);
deploy_parent = g_file_get_parent (deploy_target_path);
- if (!ot_gfile_ensure_directory (deploy_parent, TRUE, error))
+ if (!gs_file_ensure_directory (deploy_parent, TRUE, cancellable, error))
goto out;
deploy_target_etc_name = g_strconcat (deploy_target, "-", resolved_commit, "-etc", NULL);
src_modules_file = ot_gfile_from_build_path ("/lib/modules", release, NULL);
dest_modules_file = ot_gfile_get_child_build_path (self->ostree_dir, "modules", release, NULL);
dest_modules_parent = g_file_get_parent (dest_modules_file);
- if (!ot_gfile_ensure_directory (dest_modules_parent, FALSE, error))
+ if (!gs_file_ensure_directory (dest_modules_parent, FALSE, cancellable, error))
goto out;
if (!g_file_query_exists (dest_modules_file, cancellable))
g_clear_object (&dir);
dir = g_file_get_child (ostree_dir, "repo");
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
g_clear_object (&dir);
dir = g_file_get_child (ostree_dir, "deploy");
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
g_clear_object (&dir);
dir = g_file_get_child (ostree_dir, "modules");
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
g_clear_object (&dir);
*/
g_clear_object (&dir);
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "log", NULL);
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
g_clear_object (&dir);
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "tmp", NULL);
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
if (chmod (gs_file_get_path_cached (dir), 01777) < 0)
{
g_clear_object (&dir);
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "lib", NULL);
- if (!ot_gfile_ensure_directory (dir, TRUE, error))
+ if (!gs_file_ensure_directory (dir, TRUE, cancellable, error))
goto out;
g_clear_object (&dir);